﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.IO;

namespace CommTest
{
    public partial class Waveform : Form
    {
        public StreamWriter logFile;

        public Waveform()
        {
            InitializeComponent();
        }

        public void Init()
        {
            logFile = File.CreateText(Application.StartupPath + "\\LogFile.txt");
            logFile.WriteLine("Timestamp Data ID");
        }

        public void Kill()
        {
            logFile.Close();
        }

        public void NewChunk(MainForm.STSValue[] array )
        {
            // save to file
            for (int i = 0; i != array.Length; i++)
            {
                string line = string.Format("{0} {1} {2}", array[i].TimeStamp, array[i].Value, array[i].ID);
                logFile.WriteLine(line);
            }
        }
    }
}
